package com.pikaq.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pikaq.entity.User;
import com.pikaq.service.UserService;

@RequestMapping("/user")
@Controller
public class UserController {

	@Resource
	private UserService userServiceImpl;
	
	@ResponseBody
	@RequestMapping("/getuser")
	public User getUser(User user,HttpSession session){
		
		User u = userServiceImpl.getLogin(user);
		if(u!=null){
		   session.setAttribute("user", u);
		   return u;
		}
		return null;
	}
}
